1 Public Class Printing
2
3     Private Sub Printing_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
4         Module1.connect()
5         strsql =
"Select * from List_of_Returned_print"
6         acscmd.CommandText = strsql
7         acscmd.Connection = acsconn
8         acsda.SelectCommand = acscmd
9         acsda.Fill(acsds)
10         strreprotname =
"CrystalReport1"
11         Dim reportpath As String = Application.StartupPath &
"\" & strreprotname & ".rpt"
12         If Not IO.File.Exists(reportpath) Then
13             Throw (New Exception("
unable to locate report file: " & vbCrLf & reportpath))
14         End If
15         Dim rptdocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument
16         rptdocument.Load(reportpath)
17         rptdocument.SetDataSource(acsds.Tables(
0))
18         CrystalReportViewer1.ShowRefreshButton = False
19         CrystalReportViewer1.ShowCloseButton = False
20         CrystalReportViewer1.ShowGroupTreeButton = False
21         CrystalReportViewer1.ReportSource = rptdocument
22     End Sub
23 End Class


Gõ tìm kiếm nhanh...